<template>
	<view>
		<page-head headTitle="广西沃顿酒店" :user="true" @clickLeftUser="clickLeftUser"></page-head>
		<view class="m-t9">
			<view class="scan-mt bg-pic">
				<view class="flex p-t-b4">
					<view class="flex-1">
						<view class="flex justify-content font-weight index-font">{{main.goods_count}}</view>
						<text class="flex justify-content">线上商品</text>
					</view>
					<view class="flex-1">
						<view class="flex justify-content font-weight index-font">{{main.order_count_today}}</view>
						<text class="flex justify-content">今日订单</text>
					</view>
					<view class="flex-1">
						<view class="flex justify-content font-weight index-font">{{main.order_users_today}}</view>
						<text class="flex justify-content">订单人数</text>
					</view>
				</view>
			</view>
			<view class="flex mr-5 bg-white m-r5 index-mt border-r p-t-b3 box-shadowr">
				<view class="flex-1">
					<navigator url="../orde-rmanage/orde-rmanage">
						<text class="flex justify-content fs-g index-color font-weight">{{main.pay_order_count}}</text>
						<view class="flex align-center justify-content">
							<image src="/static/images/pending.png" class="pending-img">
							<text class="ml-1">待处理订单</text>
						</view>
					</navigator>
				</view>
				<view class="flex-1">
					<navigator url="">
						<text class="flex justify-content fs-g index-color font-weight">{{main.wait_comment_count}}</text>
						<view class="flex align-center justify-content">
							<image src="/static/images/see.png" class="pending-img">
							<text class="ml-1">待查看评论</text>
						</view>
					</navigator>
				</view>
			</view>
			<view class="flex m-t9">
				<navigator class="flex-1" url="../../goodsManage/goodsManage">
					<view class="flex justify-content">
						<image src="/static/images/commodity.png" mode="widthFix" class="index-public-img">
					</view>
					<text class="flex justify-content m-t-2">商品管理</text>
				</navigator>
				<navigator class="flex-1" url="../orde-rmanage/orde-rmanage">
					<view class="flex justify-content">
						<image src="/static/images/order-manage.png" mode="widthFix" class="index-public-img">
					</view>
					<text class="flex justify-content m-t-2">订单管理</text>
				</navigator>
			</view>
		</view>
		<view v-show="isShow">
			<view class="cancel-bj fixed fixed-top" @click="clickLeftHide"></view>
			<view class="left-width bg-white fixed fixed-top">
				<head-pic v-bind:name="userInfo.name" image="/static/images/picture.png"></head-pic>
				<view class="m-t7 p-l4">
					<head-list listName="订单" imageList="/static/images/order.png" @urlList="orderList"></head-list>
					<head-list listName="钱包" imageList="/static/images/wallet.png" @urlList="wallet"></head-list>
					<head-list listName="商家认证" imageList="/static/images/store-attr.png" @urlList="storeAttestation"></head-list>
					<head-list listName="设置" imageList="/static/images/setup.png" @urlList="setUp"></head-list>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import pageHead from '@/components/common/page-head.vue'
import headPic from '@/components/common/head-pic.vue'
import headList from '@/components/common/head-list.vue'
	export default {
		components:{
			pageHead,
			headPic,
			headList
		},
		data() {
			return {
				isShow:false,
				main:{},
				userInfo:{},
			}
		},
		onLoad() {
			this.getMain();
			this.userInfo = uni.getStorageSync('userInfo');
		},
		methods: {
			clickLeftUser(){
				// 点击用户图标弹出头像框
				this.isShow = true;	
			},
			// 点击隐藏头像框
			clickLeftHide(){
				this.isShow = false;
			},
			getMain(){
				this.$myRequest({
					method:'POST',
					url:'/api/merchant/main',

				}).then(res=>{
					console.log(res);
					if(res.data.code == 1){
						this.main = res.data.data;
					}
				})
			},
			orderList(){
				uni.navigateTo({
				    url: '../orde-rmanage/orde-rmanage'
				});
			},
			wallet(){
				uni.navigateTo({
				    url: '../store-wallet/store-wallet'
				});
			},
			storeAttestation(){
				uni.navigateTo({
				    url: ''
				});
			}
		}
	}
</script>

<style scoped>
page{background-color: #FFFFFF;}
.pending-img{width: 32rpx;height: 32rpx;}
.index-mt{margin-top: -90rpx;}
.index-color{color: #FF4F4F;}
.index-public-img{width: 120rpx;height: 120rpx;}


</style>
